﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="swfUploadTest.aspx.cs"
    Inherits="HandLab.WebApp.Uploads.SwfUploadPanel.swfUploadTest" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <!-- Files needed for ext -->
    <link rel="stylesheet" type="text/css" href="../ext-2.0.2/resources/css/ext-all.css" />
    <script type="text/javascript" src="../ext-2.0.2/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="../ext-2.0.2/ext-all.js"></script>
    <!-- Files needed for SwfUploaderPanel -->
    <link rel="stylesheet" type="text/css" href="SwfUploadPanel.css" />
    <script type="text/javascript" src="SwfUpload.js"></script>
    <script type="text/javascript" src="SwfUploadPanel.js"></script>
    <script type="text/javascript">
        if (!console) var console = {
            log: function () { }
        }
        Ext.onReady(function () {

            String.prototype.trim = function () {
                return this.replace(/^\s+|\s+$/g, "");
            }

            // Get SessionId from cookie
            var PHPSESSIDX = null;
            var cookies = document.cookie.split(";");
            Ext.each(cookies, function (cookie) {
                var nvp = cookie.split("=");
                if (nvp[0].trim() == 'PHPSESSID')
                    PHPSESSIDX = nvp[1];
            });

            var uploader = new Ext.ux.SwfUploadPanel({
                title: 'Upload Test'
		, renderTo: 'grid'
		, width: 500
		, height: 300

                // Uploader Params				
		, upload_url: 'upload.aspx'
                //				, upload_url: 'http://localhost/www.silverbiology.com/ext/plugins/SwfUploadPanel/upload_example.php'
		, post_params: { PHPSESSIDX: PHPSESSIDX }

		, flash_url: "swfupload.swf"
                //				, single_select: true // Select only one file from the FileDialog

                // Custom Params
		, single_file_select: false // Set to true if you only want to select one file from the FileDialog.
		, confirm_delete: false // This will prompt for removing files from queue.
		, remove_completed: false // Remove file from grid after uploaded.
            });

            uploader.on('swfUploadLoaded', function () {
                this.addPostParam('Post1', 'example1');
            });

            uploader.on('fileUploadComplete', function (panel, file, response) {
            });

            uploader.on('queueUploadComplete', function () {
                if (Ext.isGecko) {
                    console.log("Files Finished");
                } else {
                    alert("Files Finished");
                }
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="grid" style="width: 400px;">
    </div>
    </form>
</body>
</html>
